package domain

import (
	"github.com/lab-online/internal/report/constant"
	"github.com/lab-online/internal/report/entity"
	"github.com/lab-online/internal/shared/code"
	"github.com/lab-online/pkg/auth"
)

func (d *Domain) GetReport(
	authEntity auth.AuthEntity, report entity.ReportEntity,
) (entity.ReportEntity, error) {
	if report, err := d.repository.GetReportByID(report.GetID()); err != nil {
		return nil, code.ErrorPicker(
			err, code.DatabaseReportNotFound, constant.RESTErrReportNotFound,
		)
	} else {
		return report, nil
	}
}
